package cn.xorange.commons.core.basic.bean;

import com.github.pagehelper.PageInfo;
import lombok.Getter;

import java.io.Serializable;
import java.util.List;

/**
 * @author yangjian
 */
@Getter
public class PageBean implements Serializable {

    //对"rawtypes", "unchecked" 的警告保持静默
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public PageBean(List<?> list){
        PageInfo pageInfo = new PageInfo(list);
        this.total = pageInfo.getTotal();
        this.data = list;
        this.code = SystemCode.SUCCESS.getCode();
        this.httpCode = SystemCode.SUCCESS.getStatus();
        this.msg = SystemCode.SUCCESS.getMsg();
    }

    /** 总记录数 */
    private long total;

    /** 列表数据 */
    private List<?> data;

    /** 消息状态码 */
    private int code;

    /** http状态码 */
    private int httpCode;

    /** 消息内容 */
    private String msg;

}
